#pragma once

#include <gofcl_dac_l12dh.h>

typedef struct {
	u16_s : 4;
	u16_s digital_12_bit : 12;
} dac_l12dh_expl_s;

_Static_assert(sizeof(dac_l12dh_expl_s) == 2,
	       "Struct dac_l12dh_expl_s defined error!");

// 设置给定DAC的数字值为给定12位整数（左对齐）
static inline void dac_set_12_bit_digital_left(dac_dh_re dac_no_r,
					       dac_l12dh_expl_s l12dh) {
	union {
		dac_l12dh_expl_s e;
		u32_s u;
	} eu = {
		.e = l12dh,
	};
	dac_wreg_dh(dac_no_r, DAC_DH_L12DH_RR, eu.u);
}
